package com.cherrish.demo.thread;

import java.util.concurrent.CountDownLatch;

/**
 * @author ccl
 * @time 2019-02-25 11:01
 * @name ThreadsDemo
 * @desc:
 */
public class ThreadsDemo {
    public static void main(String[] args) {
        CountDownLatch cdl = new CountDownLatch(1);
        try {
            Thread.sleep(20000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for(int i = 0; i < 5000; i++){
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        cdl.await();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }).start();

            System.out.println("i = " + i);
        }
    }
}
